<?php 
/** 点赞活动自助管理  **/
function hidtel($phone){
         return  preg_replace('/(1[34578]{1}[0-9])[0-9]{4}([0-9]{4})/i','$1****$2',$phone);
 } 
//截取utf8字符串 
function utf8Substr($str, $from, $len) 
{  
return preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$from.'}'. 
'((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$len.'}).*#s', 
'$1',$str); 
} 

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no" name="viewport" id="viewport" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <title><?php echo $news['title']; ?></title>
    <meta name="description" content="微信模板" />
    <meta name="keywords" content="" /> 
    <link href="__PUBLIC__/styles/default/css/base.css" type="text/css" rel="stylesheet" />
    <link href="__PUBLIC__/styles/default/css/praise.css?v=00" type="text/css" rel="stylesheet" />
	<link href="__PUBLIC__/styles/default/css/animate.min.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="__PUBLIC__/styles/default/js/jquery-1.8.0.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="__PUBLIC__/styles/default/js/scroll.js" charset="utf-8"></script>
    <script type="text/javascript">
      $(function(){
        setTimeout(function () { 
                $("div.list_lh").myScroll({
                  speed:60, 
                  rowHeight:25 
                });
        }, 10000);
        
      });
      </script>

    <script type="text/javascript">
    $(function(){
        countDown($("#dtime").text(),"#colockbox1");
        $('#name').focus(function(){
            $('.show').empty();
        });
        $('#tel').focus(function(){
            $('.show').empty();
        });
      });
      function countDown(time,id){
        var day_elem = $(id).find('.day');
        var hour_elem = $(id).find('.hour');
        var minute_elem = $(id).find('.minute');
        var second_elem = $(id).find('.second');
        var end_time = new Date(time).getTime(),//月份是实际月份-1
        sys_second = (end_time-new Date().getTime())/1000;
        var timer = setInterval(function(){
          if (sys_second > 1) {
            sys_second -= 1;
            var day = Math.floor((sys_second / 3600) / 24);
            var hour = Math.floor((sys_second / 3600) % 24);
            var minute = Math.floor((sys_second / 60) % 60);
            var second = Math.floor(sys_second % 60);
            day_elem && $(day_elem).text(day);//计算天
            $(hour_elem).text(hour<10?"0"+hour:hour);//计算小时
            $(minute_elem).text(minute<10?"0"+minute:minute);//计算分钟
            $(second_elem).text(second<10?"0"+second:second);//计算秒杀
          } else { 
            clearInterval(timer);
          }
        }, 1000);
      }
            
    function oncheck()
    {
        var tel = $('#tel').val();
        var name = $('#name').val();
        if(name == "" || tel == "")
        {
            $('.show').html("姓名或者手机号码不能为空!");
            return false;
        }
        re= /^(13[0-9]|15[012356789]|18[02356789]|14[57]|17[0-9])[0-9]{8}$/;
        if(!re.test(tel))
        {
            $('.show').html("手机号码格式不正确!");
            return false;
        }
        
        if(tel.length != 11)
        {
            $('.show').html("手机号码必须为11位数字!");
            return false;
        }
        
        return true;
    }
  </script>
      
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
  wx.config({
    debug: false,
    appId: '{$signPackage["appId"]}',
    timestamp: '{$signPackage["timestamp"]}',
    nonceStr: '{$signPackage["nonceStr"]}',
    signature: '{$signPackage["signature"]}',
    jsApiList: [
      // 所有要调用的 API 都要加到这个列表中
      'onMenuShareTimeline','onMenuShareAppMessage'
    ]
  });
  wx.ready(function () {
    // 在这里调用 API
 
    wx.onMenuShareTimeline({
      title: "{$news['title']}",// 分享标题
	  link: "http://www.dscm.com.cn/xcrm/index.php?m=Wap&c=Praise&a=index&hdid={$hdid}&fx_id={$fx_id}", // 分享链接
      desc: "{$news['xxsm']}", // 分享描述
      imgUrl: "http://www.dscm.com.cn{$news.style.fx}", // 分享图标
      trigger: function () {
          //alert("点击分享：");
      },
      success: function () { 
          // 用户确认分享后执行的回调函数
          //alert("分享成功");
      },
      cancel: function () { 
          // 用户取消分享后执行的回调函数
          //alert("用户取消分享");
      }
    });
  
  	wx.onMenuShareAppMessage({
      title: "{$news['title']}",// 分享标题
	  link: "http://www.dscm.com.cn/xcrm/index.php?m=Wap&c=Praise&a=index&hdid={$hdid}&fx_id={$fx_id}", // 分享链接
      desc: "{$news['xxsm']}", // 分享描述
      	imgUrl: "http://www.dscm.com.cn{$news.style.fx}", // 分享图标
    	type: 'link', // 分享类型,music、video或link，不填默认为link
		success: function () { 
			// 用户确认分享后执行的回调函数  
		},
		cancel: function () { 
			// 用户取消分享后执行的回调函数
		}
	 });
  });
</script>
</head>
<body class="animated bounceInDown"> 

<style>
#snowfall {
 position:fixed;
 top:0;
 left:0;
width:100%;
pointer-events: none; z-index: 100001;
}
.top_show{width:100%;}
#audio_btn  img{position:absolute;right:10px;top:2px;}
</style>
<canvas id="snowfall" width="757" height="826"></canvas>
<div class="top_show">
	<img src="__PUBLIC__/styles/default/images/snow/nyear.gif" width="100%" />
<audio id="music" src="__PUBLIC__/styles/default/images/snow/nyear.mp3" autoplay="autoplay" loop="loop">你的浏览器不支持audio标签。</audio>    
<a id="audio_btn"><img src="__PUBLIC__/styles/default/images/snow/play.png" width="48" height="50" id="music_btn" border="0"></a>   
</div> 
<script>    
$("#audio_btn").click(function(){    
    var music = document.getElementById("music");    
    if(music.paused){    
        music.play();    
        $("#music_btn").attr("src","__PUBLIC__/styles/default/images/snow/play.png");    
    }else{    
        music.pause();    
        $("#music_btn").attr("src","__PUBLIC__/styles/default/images/snow/pause.png");    
    }    
});    
</script>
  <!--	__SELF__<br/> __PUBLIC__<br/>
  参加人数：{$cjrs}<br/> 
    总点赞人数：{$zlrs}<br/>
    阅读次数：{$ydcs}<br/>
	
    当前用户是否参加{$is_join}<br/>
    分享用户是否参加{$is_fx_join}<br/>
    当前用户币{$coin}<br/>
    分享币{$fx_coin}<br/>
    wx——id{$wx_id}<br/>
    fx——id{$fx_id}<br/>{$wx_user['name']} 位置:{$position}-->
	<!--<audio src="__PUBLIC__/styles/default/images/haixin.mp3" autoplay="autoplay" loop="loop"></audio>-->
    <div id="all">  
         <div class="header1">
		 	<?php 
			foreach($news['style']['top'] as $val)
			{
				echo "<img src='$val' width='100%' />";
			}
			?>
         </div>
         
        <!--<div style="margin-top:10px;background-color:#fff;font-size:20px;height:40px;line-height:40px;text-align:center;font-family:Arial, Helvetica, sans-serif;">活动倒计时，距离结束还有</div> -->
        <div id="dtime" style="display:none"><?php  echo date("Y/m/d H:i:s", $news['jssj']);?></div>
        <div class="colockbox" id="colockbox1" style="text-align:center;margin-bottom:0px;"><span class="day">00</span> 天 <span class="hour">00</span> 时 <span class="minute">00</span> 分 <span class="second">00</span> 秒 </div>

<!--		<img src="__PUBLIC__/styles/default/images/haixin_09.jpg" width="100%" /> -->
		
        <div class="help" id="wejoin">
 			
            
        	<?php if($fx_id == $wx_id){ ?>
            
          		<?php if($is_join) {echo '<p  style="margin:30px 0;line-height:30px;font-size:26px;padding:0 10px;color:#F36;">您('.$wx_user['name'].')现在有'.$coin.'点赞币</p>'; }else{
						echo '<p  style="margin:30px 0;line-height:30px;font-size:26px;padding:0 10px;color:#F36;">您还没有参加活动，赶快来参加吧.</p>';} ?>
                        
		  	<?php }else{ ?>
            	<?php if($is_fx_join){ ?>
          			<h2 style="margin:30px 0;line-height:30px;font-size:26px;color:#F36;">大奖来袭，帮TA点赞！<br/>(<?php echo $fx_user['name'];?>已有<?php echo $fx_coin;?>点赞币)</h2>
                <?php }else{?>
                	<?php if($is_join) {echo '<p  style="margin:30px 0;line-height:30px;font-size:26px;padding:0 10px;color:#F36;">您('.$wx_user['name'].')现在有'.$coin.'点赞币</p>'; }else{
						echo '<p  style="margin:30px 0;line-height:30px;font-size:26px;color:#F36;padding:0 10px;">您还没有参加活动，赶快来参加吧.</p>';} ?>
                <?php } ?>
		  	<?php }?>
            
                      
          <div class="fx_notice">
            <p>
            	<?php if($is_fx_join){ ?>
          			<span style="color:red;"><?php echo $fx_user['name'];?></span> 当前有<span class="zlb"><?php echo $fx_coin;?></span>点赞币！
                <?php }else{?>
                	当前用户还没有参加活动哦，赶紧来参加吧.
                <?php } ?>
            </p>
          </div>
            
		  <div class="notice1">
            <p>
            </p>
          </div>
<style>
.tip{
	width:30%;
	position:absolute;
	z-index:111;
	top:30px;
	right:15%;
	opacity:0.8;
}
</style>			
		  <div class="tip animated infinite fadeInUp" id="dowebok">
		  	<img src="__PUBLIC__/styles/default/images/4.png" />
		  </div>	
			
          <div class="helpdiv"></div>
          <div class="help1" style="background:{$news['style']['color'][0]};">
            <div class="help2">
              <div class="help3" style="background:{$news['style']['color'][0]};">
                <div style="line-height: 50px;margin-top: 40px;">
                	帮友点赞 <br/>
                	赢取豪礼
                </div>	
              </div>
            </div>
          </div>
		
          <div class="notice2">
            <form action="index.php?s=/Wap/Praise/weixinadd/" method="post" enctype="multipart/form-data" onsubmit="return oncheck()">   
                     
			<?php if($is_join) {echo '<p><a style="color:#fff;" href="http://www.dscm.com.cn/xcrm/index.php?s=/Wap/Praise/index/hdid/'.$hdid.'">您已参加活动,您现在有'.$coin.'点赞币<br/>点击进入你的活动页</a></p><a href="javascript:void();" class="none">Close</a>'; }
            else{?> <p>您的姓名:           
			<input type="text" name="name" value="<?php echo $wx_user['name'];?>" id="name" /></p> 
            <input name="id" type="hidden" value="<?php echo $wx_id;?>" />
            <input name="hdid" type="hidden" value="<?php echo $hdid;?>" />
            <p>您的手机: <input type="text" name="tel" value="<?php echo $wx_user['tel'];?>" id="tel" /></p>
            <input type="submit" value="提交" class="btn1" />
			<input type="button" value="取消" class="btn1 none" /><?php }?>
			<div class="show"></div>
            <!--<a href="javascript:void();" class="none">Close</a>-->
          	</form>
          </div>

          <div class="notice3">
		  	<?php if($fx_zl['share']){ ?>
				<p style="color:#C0F;font-size:14px;">您已经领过产品啦！</p>
				<a href="javascript:void();" class="none">Close</a>
			<?php }else{ ?>
			<p>请输入管理员核销码</p>     
            <p><input type="number" name="code" value="" id="code" /></p>
            <input type="button" value="确认" class="btn1" onclick="onyanzheng()"/>
			<input type="button" value="取消" class="btn1 none" />
			<div class="showyz" style="color:red;font-weight:bold;font-size:12px;"></div>
          	</form>
			<?php } ?>
<!--			<p style="color:#C0F;font-size:14px;">{$tips}</p>
			<a href="javascript:void(check())" style="font-size:18px;font-weight:bold;color:red;padding:2px 12px;background:#CCC;">点击我核销</a>
			<br/>
			<a href="javascript:void();" class="none">Close</a>-->
			
			
          </div>

		  <div class="help4">
            <a href="javascript:void();" class="a1" style="background:{$news['style']['color'][1]};"><?php if($is_join){echo "我的活动页";}else{echo "我要参加";} ?></a>
			<?php if($fx_id == $wx_id){ ?>
				<a href="javascript:void();" class="a2" style="background:{$news['style']['color'][1]};">我要购买</a>
			<?php }else{ ?>
				<a href="javascript:void();" onclick="_system._guide(true)" class="a0" style="background:{$news['style']['color'][1]};">帮TA分享</a>
			<?php }?>
          </div>
		  
<style>
.praise{width:100%;height:auto;margin-bottom:10px;}
.praise h3{width:100%;line-height:26px;font-size:18px;color:#90C;background:#F90;}
.praise div{width:15%;margin-left:1.5%;text-align:left;float:left;margin-top:5px;}
.praise img{width:100%;}
</style>		
		<div class="praise">
			<h3>帮友点赞列表</h3>
			<?php
				foreach($praise_list AS $one){?> 
				<div><img src="<?php echo $one['pic']; ?>" /></div>
			<?php }?>
		</div>
          
        </div>
		
        <script>
		function onyanzheng()
		{
			var code = $('#code').val();
			if(code == "")
			{
				$('.showyz').html("核销码不能为空!");
				//return false;
			}
			else
			{
				$.get("http://www.dscm.com.cn/xcrm/index.php?s=/Wap/Praise/yanzheng/wxid/{$wx_id}/wx1/{$fx_id}/hdid/{$hdid}/code/"+code,function(data,status){
					$('.showyz').html(data);
					/*$(".notice3").animate({
						top:'50px',
						left:'-999px'
					});*/
				});
			}		
		}
		function check(){
			$.get("http://www.dscm.com.cn/xcrm/index.php?s=/Wap/Praise/yanzheng/wxid/{$wx_id}/wx1/{$fx_id}/hdid/{$hdid}",function(data,status){
				alert(data); 
				$(".notice3").animate({
					top:'50px',
					left:'-999px'
				});
			});
		}
		$(function(){
        	$(".help1").click(function(){
              $(".help1").hide();	
			  /*$('.show1').fadeOut(2000,function(){
				  $('.show2').fadeToggle(2000);
			  });*/
			  $.get("http://www.dscm.com.cn/xcrm/index.php?s=/Wap/Praise/praiseapi/wxid/{$wx_id}/uid/{$openid}/wx1/{$fx_id}/hdid/{$hdid}",function(data,status){
				//alert(data.split(",")[0]);  
				$(".notice1 p").text(data.split(",")[0]); 
				$(".zlb").text(String(data.split(",")[1])); 
				$(".notice1").fadeToggle(1000).fadeOut(2000,function(){
				   $('.fx_notice').fadeToggle(2000);
				});
			  });	
 				
          	});
		   
			// 我要参加活动点击事件；
		   $(".a1").click(function(){
			  $(".notice2").animate({
				top:'50px',
				left:'12px'
			  });
			});

			$('.none').click(function(){
			  $(".notice2").animate({
				top:'50px',
				left:'-999px'
			  });
			}); 
       
	   		// 查看收钱罐点击事件处理；
            $(".a2").click(function(){
                  $(".notice3").animate({
                    top:'50px',
                    left:'12px'
                  });
                });

                $('.none').click(function(){
                  $(".notice3").animate({
                    top:'50px',
                    left:'-999px'
                  });
                });  


                $(".notice2 input[type='text']").focus(function(){
                  $(this).val("");
                })
            });
        </script>
		
		<?php 
			foreach($news['style']['end'] as $val)
			{
				echo "<img src='$val' width='100%' />";
			}
		?>
		
		<?php if($hdid == 70){ ?>
			<a href="http://www.dscm.com.cn/xcrm/index.php?m=Wap&c=Tzhuli&a=index&hdid=49"><img src="http://www.dscm.com.cn/xcrm/uploads/kindeditor/image/20160105/20160105112641_99419.jpg" width="100%" /></a>
		<?php } ?>

<!--		<div class="phb">
        	<p><span>总点赞人次：{$zlrs}(次)</span></p>
        </div> -->

        <div class="list" style="background:{$news['style']['color'][2]};">  
          <h4><span>排行</span><span>姓名</span><span style="width:25%;">手机号</span><span style="width:25%;">点赞币</span></h4>
          <div class="list_lh" style="height:auto;max-height:2500px;">
			  <ul><?php
				$i=1;
				foreach($praisetop AS $one){?> 
			   <li><span><?php echo $i;$i++; ?></span><span><?php echo utf8Substr($one['name'], 0, 3);?></span><span style="width:25%;"><?php echo hidtel($one['tel']);?></span><span style="width:25%;"><?php echo $one['zlb'];?>点赞币</span></li>
			  <?php }?>
			  </ul>
          </div>

          <h3 style="margin-bottom:0px;height:30px;line-height:30px;color:#F00;">参加人数：
		 <?php if($hdid==57){echo 500+$cjrs;}else{echo $cjrs;} ?> (人)，阅读次数：{$ydcs}（次）</h3>

		  <h3 style="height:20px;line-height:20px;color:#F00;margin-bottom:45px;">
		  <?php 
		  	if(empty($news['style']['title'][0]))
			{
				echo "咪游网络";	
			}
			else
			{ ?>
				{$news['style']['title'][0]}
		  <?php	
			}
		  ?>
		  
		  </h3>     
        </div>
        
        <!--<img src="__PUBLIC__/styles/default/images/haixin_16.jpg" width="100%" style="margin-bottom:25px;"/>-->
        
        <div id="footer"> 
          <a href="#wejoin"><?php if($aa){echo $aa;}else	  if($news['kssj']>time()){
				  echo '活动尚未开始,敬请期待!';
				  }else if($news['jssj']<time()){
					   echo '活动已结束,下期再见!';
					  }else{
						      echo '活动进行中，邀友点赞吧！';
						  }
			  
			  ?>
			  <!-- <marquee>维护通知：尊敬的用户您好，系统将于12月05日下午6时-12月06日早上8点进行维护，给您造成的不便敬请谅解</marquee>  -->
			  </a>
        </div>

<!--            <script>
              $(function(){
                $('.a3').click(function(){
                  $('.share-box').slideToggle("slow");
                });

                $('.hide').click(function(){
                  $('.share-box').hide();
                });
              });
            </script>-->
    </div> 
<style type="text/css">
button{width:100%;text-align:center;border-radius:3px;}
.button2{font-size:16px;padding:8px 0;border:1px solid #adadab;color:#000000;background-color: #e8e8e8;background-image:linear-gradient(to top, #dbdbdb, #f4f4f4);background-image:-webkit-gradient(linear, 0 100%, 0 0, from(#dbdbdb),to(#f4f4f4));box-shadow: 0 1px 1px rgba(0,0,0,0.45), inset 0 1px 1px #efefef; text-shadow: 0.5px 0.5px 1px #ffffff;}
.button2:active{background-color: #dedede;background-image: linear-gradient(to top, #cacaca, #e0e0e0);background-image:-webkit-gradient(linear, 0 100%, 0 0, from(#cacaca),to(#e0e0e0));}
#mess_share{margin:15px 0;}
#share_1{float:left;width:49%;}
#share_2{float:right;width:49%;}
#mess_share img{width:22px;height:22px;}
#cover{display:none;position:absolute;left:0;top:0;z-index:18888;background-color:#000000;opacity:0.7;}
#guide{display:none;position:absolute;right:18px;top:5px;z-index:19999;}
#guide img{width:260px;height:180px;}
</style>
<script type="text/javascript">

    var _system={

        $:function(id){return document.getElementById(id);},

   _client:function(){

      return {w:document.documentElement.scrollWidth,h:document.documentElement.scrollHeight,bw:document.documentElement.clientWidth,bh:document.documentElement.clientHeight};

   },

   _scroll:function(){

      return {x:document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft,y:document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop};

   },

   _cover:function(show){

      if(show){

     this.$("cover").style.display="block";

     this.$("cover").style.width=(this._client().bw>this._client().w?this._client().bw:this._client().w)+"px";

     this.$("cover").style.height=(this._client().bh>this._client().h?this._client().bh:this._client().h)+"px";

  }else{

     this.$("cover").style.display="none";

  }

   },

   _guide:function(click){

      this._cover(true);

      this.$("guide").style.display="block";

      this.$("guide").style.top=(_system._scroll().y+5)+"px";

      window.onresize=function(){_system._cover(true);_system.$("guide").style.top=(_system._scroll().y+5)+"px";};

  if(click){_system.$("cover").onclick=function(){

         _system._cover();

         _system.$("guide").style.display="none";

 _system.$("cover").onclick=null;

 window.onresize=null;

  };}

   },

   _zero:function(n){

      return n<0?0:n;

   }
}
</script>
<div id="cover" style="display: none; width: 1920px; height: 891px;"></div>
<div id="guide" style="display: none; top: 5px;"><img src="__PUBLIC__/styles/default/images/guide1.png"></div>
<script src="__PUBLIC__/styles/default/js/cm.js" type="text/javascript"></script>    

<script src="__PUBLIC__/styles/default/js/rectangleEmitter.js"></script>
<script src="__PUBLIC__/styles/default/js/snow.js"></script>
<script src="__PUBLIC__/styles/default/js/main.js"></script>
</body>
</html>